
layui.use(['layer','laydate'], function(){
    var laydate = layui.laydate;
    laydate.render({
        elem: '#workDate'
        ,max: -1
    });
    componentSelectInit(
        {
            ctxPath:'',
            tableName:"wn_farm",
            showValueField:"name",
            valueField:"id",
            selectId:"farmId"  ,
            where:""
        }
        ,function(){
        });
});
var wnMachineWorkReportGt06ConsoleGrid =new consoleGrid({table_id:"wnMachineWorkReportGt06"});
wnMachineWorkReportGt06ConsoleGrid.init();
function wnMachineWorkReportGt06TableOperate(value,row,index){
    return "<button type='button' class='btn btn-xs btn-success' onclick='traceBack(\""+row.deviceId+"\",\""+row.startTime+"\",\""+row.endTime+"\")'>查看轨迹</button> ";
}
function traceBack(deviceId,startTime,endTime) {
    startTime=consoleTableDateTimeFormat(startTime);
    endTime = consoleTableDateTimeFormat(endTime);
    var obj={
        id:'traceBack',
        url:'/console/machine/gt06/trace/page/time?deviceId='+deviceId+'&startTime='+startTime+'&endTime='+endTime,
        title:'轨迹回放',
        height:600
    }
    consoleOpenWindowObj(obj);
}
function wnMachineWorkReportGt06LoadParam(params){
params.query=wnMachineWorkReportGt06QueryString();
return params;
}
function wnMachineWorkReportGt06QueryString() {
var objQuery = new Object();
    objQuery.startTime=$('#startTime').val()==''?null:$('#startTime').val(); 
     objQuery.endTime=$('#endTime').val()==''?null:$('#endTime').val(); 
     objQuery.workDate=$('#workDate').val()==''?null:$('#workDate').val(); 
     objQuery.workArea=$('#workArea').val()==''?null:$('#workArea').val(); 
     objQuery.workBreadth=$('#workBreadth').val()==''?null:$('#workBreadth').val(); 
     objQuery.deviceId=$('#deviceId').val()==''?null:$('#deviceId').val(); 
     objQuery.farmId=$('#farmId').val()==''?null:$('#farmId').val(); 
     objQuery.machineId=$('#machineId').val()==''?null:$('#machineId').val(); 
 
var queryString = JSON.stringify(objQuery);
return queryString;
}

